<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<head>
    {include file="common_header"}
    <title>添加优惠券</title>
</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="forms" method="post" enctype="multipart/form-data" action="{:url('edit')}" >
        <input type="hidden" value="{$data.id}" name="id">
        <div class="row cl">
            <label class="form-label col-xs-3 col-xs-offset-1"><span class="c-red">*</span>优惠券名称：</label>
            <div class="formControls col-xs-6">
                <input type="text" class="input-text" value="{$data.name}" placeholder="请输入优惠券名称" id="name" name="name" datatype="*" nullmsg="请输入优惠券名称">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-xs-offset-1"><span class="c-red">*</span>优惠券价格：</label>
            <div class="formControls col-xs-6">
                <input type="text" class="input-text" value="{$data.price}" placeholder="请输入优惠券价格" id="price" name="price" datatype="/^-?[1-9]+(\.\d+)?$|^-?0(\.\d+)?$|^-?[1-9]+[0-9]*(\.\d+)?$/"  errormsg="优惠券价格必须为数字，可以有小数"  nullmsg="请输入优惠券价格" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')">
            </div>
        </div>
       <!-- <div class="row cl">
            <label class="form-label col-xs-3 col-xs-offset-1"><span class="c-red">*</span>满减价格：</label>
            <div class="formControls col-xs-6">
                <input type="text" class="input-text" value="{$data.mjprice}" placeholder="请输入优惠券满减价格" id="mjprice" name="mjprice" datatype="/^-?[1-9]+(\.\d+)?$|^-?0(\.\d+)?$|^-?[1-9]+[0-9]*(\.\d+)?$/"  errormsg="优惠券满减价格必须为数字，可以有小数"  nullmsg="请输入优惠券满减价格" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')">
            </div>
        </div>-->
        <div class="row cl">
            <label class="form-label col-xs-3 col-xs-offset-1"><span class="c-red">*</span>优惠券数量：</label>
            <div class="formControls col-xs-6">
                <input type="text" class="input-text" value="{$data.num}" placeholder="请输入优惠券数量" id="num" name="num" datatype="n" nullmsg="请输入优惠券数量" errormsg="优惠券数量只能输入数字">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-xs-offset-1"><span class="c-red">*</span>优惠券描述：</label>
            <div class="formControls col-xs-6">
                <textarea  cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*" id="content" name="content"  nullmsg="优惠券描述不能为空" >{$data.content}</textarea>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-xs-offset-1"><span class="c-red">*</span>开始时间：</label>
            <div class="formControls col-xs-6">
                <input type="text"  autocomplete="off"  onfocus="WdatePicker()" value="{$data.starttime|date='Y-m-d',###}" placeholder="开始时间" id="starttime" name="starttime" class="input-text Wdate" style="width:270px;">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-xs-offset-1"><span class="c-red">*</span>结束时间：</label>
            <div class="formControls col-xs-6">
                <input type="text"  autocomplete="off"   onfocus="WdatePicker()" value="{$data.endtime|date='Y-m-d',###}" placeholder="结束时间" id="endtime" name="endtime"  class="input-text Wdate" style="width:270px;">
            </div>
        </div>
        <div class="row cl pd-20">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" onclick="check()">
            </div>
        </div>
    </form>
</article>
<!--_footer 作为公共模版分离出去-->
{include file="common_footer"}
<!--/_footer 作为公共模版分离出去-->
</body>
<script>
    function check(){
        var start=$("#starttime").val();
        var end=$("#endtime").val();
        if(start>end){
            layer.msg("开始时间不能大于结束时间");
            return false;
        }else{
            $("#forms").submit();
        }

    }
</script>
</html>